﻿
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="StudentMainPage.aspx.cs" Inherits="CMSWCSFSolution.CMS.Views.StudentMainPage"
    Title="StudentMaster" MasterPageFile="~/Shared/DefaultMaster.master" %>
<asp:Content ID="content" ContentPlaceHolderID="DefaultContent" Runat="Server">
    <script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.blockUI.js" type="text/javascript"></script>
    <link href="../Styles/jquery-ui-1.8.24.custom.css" rel="stylesheet" type="text/css" />
<script src="../Scripts/jquery-ui-1.8.24.custom.min.js" type="text/javascript"></script>

<script src="../Scripts/CMS_dialog.js" type="text/javascript"></script>

   <script type="text/javascript">
       {
           var studentId;

           function showDeleteConfirmation(sId) {

               studentId = sId
               $.blockUI({ message: $('#divConfirmBox') });

           }

           function deleteStudent() {
               $("#<%=hfStudentId.ClientID%>").val(studentId);
               $.unblockUI();
           }
       }
       </script>

		<h1>StudentMaster</h1>
           <asp:Panel ID="PanelStudentList" runat="server">
        <fieldset>
        <legend >Student List</legend>
        <br />
            <asp:Button ID="btnaddStudent" runat="server" Text="Create New Student" onclick="btnaddStudent_Click"  />
            <br />
            <br />
            <asp:GridView ID="gvStudentInfo" runat="server" 
                CellPadding="4" ForeColor="#D7EBF" GridLines="None" onrowediting="gvStudentInfo_RowEditing"
                AutoGenerateColumns="False"   DataKeyNames="StudentId" >
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                <Columns>
                    <asp:BoundField Datafield="StudentId" HeaderText="Student Id" />
                    <asp:BoundField Datafield="StudentName" HeaderText="Student Name" />
                    <asp:BoundField Datafield="StudentGender" HeaderText="Student Gender" />
                    <asp:BoundField Datafield="ClassName" HeaderText="Class Name" />
                    <asp:templatefield>
                        <itemtemplate>
                            <asp:button id="btnupdate" runat="server" causesvalidation="False" 
                                commandname="edit" text="Update" />
                        </itemtemplate>
                    </asp:templatefield>
                    <asp:TemplateField ShowHeader="False">
                        <ItemTemplate>
                               <input type="button" value="Delete" id="btnDelete" onclick="showDeleteConfirmation('<%# Eval("StudentId") %>')" />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <EditRowStyle BackColor="#999999" />
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#AED0EA" Font-Bold="True" ForeColor="#2779AA " />
                <PagerSettings PageButtonCount="2" Position="TopAndBottom" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#E9E7E2" />
                <SortedAscendingHeaderStyle BackColor="#506C8C" />
                <SortedDescendingCellStyle BackColor="#FFFDF8" />
                <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
            </asp:GridView>

            <br />
            <asp:LinkButton id="btnFirst"  Text="&lt;&lt;" runat="server" OnClick="PageNavaigage_Click" CommandName="First" ></asp:LinkButton>
            <asp:LinkButton id="btnPre" Text="&lt;" runat="server" OnClick="PageNavaigage_Click" CommandName="Previous" ></asp:LinkButton>
            <asp:Label runat="server" ID="lblPagesIndex" BackColor="White"  ForeColor="Black"></asp:Label>
            <asp:LinkButton id="btnNext" Text=" &gt" runat="server"  OnClick="PageNavaigage_Click" CommandName="Next"></asp:LinkButton>
            <asp:LinkButton id="btnLast" Text=" &gt;&gt;" runat="server" OnClick="PageNavaigage_Click" CommandName="Last" ></asp:LinkButton>
            <asp:Label runat="server" id="lblRowsCount" BackColor="White" ForeColor="Black"></asp:Label> &nbsp;&nbsp;
            <asp:Label runat="server" ID="Label2" Text="Go To：" BackColor="White" ForeColor="Black"></asp:Label>
            <asp:TextBox ID="txtSkipPage" runat="server"  Width="40px" MaxLength="4"></asp:TextBox>
            <asp:Button ID="btnSkip" Text="Go" runat="server"  OnClick="btnSkip_Click"></asp:Button>
            <br />
            <br />

             <div id="divConfirmBox"  style="display:none" class=" ui-widget ui-widget-content ui-corner-all ui-jqdialog jqmID1" id="alertmod" dir="ltr" style="width: 200px; height: auto; z-index: 950; overflow: hidden; top: 268px; left: 473px; display: block; " tabindex="-1" role="dialog" aria-labelledby="alerthd" aria-hidden="false">
             <div class="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix" id="alerthd" style="cursor: move; ">
             <span class="ui-jqdialog-title" style="float: left; ">Warning</span>
             <a href="javascript:void(0)" class="ui-jqdialog-titlebar-close ui-corner-all"></a>
             </div>        
              Are you sure you want <br />
              to delete this record?<br />
             <asp:Button ID="btnDeleteStudent" OnClientClick="deleteStudent();" OnClick="btn_DeleteStudent" UseSubmitBehavior="false" runat="server" Text="Yes" />
             <input type="button" value="No" onclick="$.unblockUI()" />
             <span tabindex="0"><span tabindex="-1" id="jqg_alrt"></span>
             </span>
             <br />
             </div>
             <asp:HiddenField ID="hfStudentId" runat="server" />
        </fieldset>
        </asp:Panel>
</asp:Content>
